<?php
//程序设计：℃冻番茄 QQ:7279915 E-mail:web@ye55.com www.phpd.cn
require_once("config.php");
?>
<!DOCTYPE htm PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <HEAD>
  <TITLE> chat </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="css/global.css" rel="stylesheet" type="text/css" />
  <SCRIPT LANGUAGE="JavaScript" src="js/jquery.js"></SCRIPT>
 </HEAD>
 <BODY>
 <div id="main">
	<div id="main_left" style="float:none;margin:0px auto;">
		<div id="chat_m" style="width:500px;height:500px;border:#cccccc 1px solid;overflow:auto;">Loading...</div>
		 <div id="main_l_from">
		 <FORM METHOD=POST ACTION="javascript:void(0)">
			昵称：<INPUT TYPE="text" NAME="user" id="user" size="8" value="<?php echo $_SESSION['user']?>"> 内容:
			<INPUT TYPE="text" NAME="message" id="message" style="width:250px;"> <INPUT TYPE="submit" name="sub" value="发言" id="sub">
		 </div></FORM>
	</div>
	
<script type="text/javascript">
$(document).ready(function(){
	$("#chat_m").load("chat.php");
	$("#sub").click(function(){
		if($("#user").val()==''){
			alert("昵称不能为空!");
		}else if($("#message").val()==''){
			alert("聊天内容不能为空!");
		}else{
				$.post("ajax.php?act=send",{user:$("#user").val(),msg:$("#message").val()},function(data){
					if(data.msg===true){
						showmsg();
						$("#message").val("");
					}else{
						alert(data.msg);	
					}
				},"json")
			}
	})
	
});
function sc() 
	{ 
	var e=document.getElementById("chat_m") 
	e.scrollTop=e.scrollHeight; 
	} 
</script>
<hr size=1>
<center>程序设计：℃冻番茄 QQ:7279915 E-mail:web@ye55.com <a href="http://www.phpd.cn">www.phpd.cn</a> </center>